﻿using Super_Management_Mayhem.Screens.Playing.AttackModel;
using Transformable_Engine_v2.Engine.GameObjects.Containers;
using Transformable_Engine_v2.Engine.Time;
using Transformable_Engine_v2.Engine.Transformable_Math.Geometry;

namespace Super_Management_Mayhem.Screens.Playing.Particle.Explosion
{
    public class Explosion : Container, IAttacker
    {
        public static readonly TE_Rectangle Bounding = new TE_Rectangle(0, 0, 5, 5, TE_Rectangle.Alignment.CenterMiddle).ToGridBound();

        private RadialAttack _attack;

        public Explosion(TE_Vector2 position)
        {
            _attack = new RadialAttack(BaseAttack.TargetTeam.Any,
                                                null,
                                                this,
                                                5,
                                                500,
                                                Bounding,
                                                24);

            var hitTimer = new Timer(75, false, BombAttack);
            hitTimer.Start();
            AddTimers(hitTimer);

            Position = position;

            AddChildren(new BombInside(), new BombOutline());

            Die(1200);
        }

        private void BombAttack()
        {
            _attack.Attack(AbsolutePosition);
        }

        public IAttacker GetReference()
        {
            return this;
        }

        public void OnAttack()
        {
            
        }
    }
}